<template>
	<view class="L-main">
		<uni-nav-bar left-icon="back" color="#fff" background-color="#5498ff" @clickLeft="$goBack">
			<view>工信专区</view>
		</uni-nav-bar>
		<view class="header">
			<view class="search">
				<view class="select">
					<picker :range="city" :value="cityIndex" @change="cityChange">
						<view class="selectName">
							<text>{{ city[cityIndex] }}</text>
							<image src="../../static/workMessage/down.png"></image>
						</view>
					</picker>
				</view>
				<view class="search_box" @click="search">
					<view class="img">
						<image src="../../static/workMessage/search.png"></image>
					</view>
					<view class="inp">
						<input type="text" disabled placeholder="搜索需要办理得事项名称" placeholder-style="color:#fff;font-size:26rpx" />
					</view>
				</view>
			</view>
			<view class="info">
				<view>您好，{{ userInfo.user.name }}</view>
				<view>关联企业</view>
			</view>
			<view class="theme">
				<text>工信专区</text>
				<text>全省企业在线办事专区</text>
			</view>
		</view>
		<view class="nav">
			<view class="navBox" @click="$gopage('/pages/bright/online')">
				<image src="../../static/workMessage/nav_icon1.png"></image>
				<text>在线办理</text>
			</view>
			<view class="navBox" @click="$gopage('/pages/bright/handling')">
				<image src="../../static/workMessage/nav_icon2.png"></image>
				<text>办件查询</text>
			</view>
			<view class="navBox" @click="$gopage('/pages/index/enterprise')">
				<image src="../../static/workMessage/nav_icon3.png"></image>
				<text>企业专区</text>
			</view>
			<view class="navBox" @click="$gopage('/pages/dedicatedSpace/index')">
				<image src="../../static/workMessage/nav_icon4.png"></image>
				<text>专属空间</text>
			</view>
		</view>
		<view class="do_thing">
			<view>
				<image src="../../static/workMessage/nav_icon5.png"></image>
				<text>我的办件</text>
			</view>
			<view @click="$gopage('/pages/mineBanJian/mineBanJian')">
				<text>去看看</text>
			</view>
		</view>
		<view class="hr"></view>
		<view class="themeClass">
			<view class="title">
				<text>主题分类</text>
				<text @click="$gopage('/pages/bright/online?type=2')">更多</text>
			</view>
			<view class="card">
				<view @click="toTheme('XK','行政许可')">
					<text>行政许可</text>
					<image src="../../static/workMessage/nav_icon6.png" style="width: 88rpx;height: 66rpx;"></image>
				</view>
				<view @click="toTheme('QR','行政确认')">
					<text>行政确认</text>
					<image src="../../static/workMessage/nav_icon7.png" style="width: 67rpx;height: 74rpx;"></image>
				</view>
				<view @click="toTheme('GG','公共服务')">
					<text>公共服务</text>
					<image src="../../static/workMessage/nav_icon8.png" style="width: 67rpx;height: 67rpx;"></image>
				</view>
			</view>
		</view>
		<view class="hr"></view>
		<view class="list_box">
			<view class="title">
				<text>热门事项</text>
			</view>
			<view class="accordionBox">
				<!-- <uni-collapse accordion @change="collapseChange">
				    <uni-collapse-item :title="item.name" v-for="(item,index) in list" :key="index" :showAnimation="true" @change="collapseItem">
				        <view class="list">
							<view v-for="(items,indexs) in item.arr" :key="indexs">
								<text>{{ items }}</text>
								<image src="../../static/workMessage/right.png"></image>
							</view>
						</view>
				    </uni-collapse-item>
				</uni-collapse> -->
				<view class="lists">
					<view v-for="(item,index) in items" :key="index" @click="toDetail(item.itemCode)">
						<text>{{ item.name }}</text>
						<image src="../../static/workMessage/right.png"></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uniNavBar from '@/uni-ui/libs/uni-nav-bar/uni-nav-bar.vue';
	export default {
		components: {
			uniNavBar
		},
		data() {
			return {
				title: 'Hello',
				city: ['江西'],
				cityIndex: 0,
				list: [{
					name: '无线电频率使用许可',
					arr: ['稀土深加工（技改）项目核准', '黄金采选矿（技改）项目核准']
				}, {
					name: '无线电频率使用萨大大苏打的啊大萨大阿萨大暗示啊许可',
					arr: ['稀土深加工（技改）项目核准', '黄金采选矿（技改）项目核准']
				}, {
					name: '无线电频率使用许可',
					arr: ['稀土深加工（技改）项目核准', '黄金采选矿（技改）项目核准']
				}],
				items: [],
				userInfo:{
					user:{}
				}
			}
		},
		onLoad() {
			this.selectItems();
			this.$getUserInfo().then(res=>{
				this.userInfo = res.data;
				uni.setStorageSync('userType', res.data.user.userType);
			})
		},
		methods: {
			search(){
				uni.navigateTo({
					url:'/pages/index/search'
				})
			},
			toDetail(itemCode){
				uni.navigateTo({
					url:'/pages/matter/baseInfo?itemCode='+itemCode
				})
			},
			toTheme(type,name){
				uni.navigateTo({
					url:'/pages/bright/administrative?type='+type + '&title=' + name
				})
			},
			collapseChange(e) {
				// console.log(e)
			},
			collapseItem(e) {
				console.log(e)
			},
			cityChange(e) {
				this.cityIndex = e.target.value;
			},
			selectItems() {
				this.$ajax({
					url: '/api/wwwBiz/selectItems',
					method: 'GET',
					params: {
						num: 10
					}
				}).then(res => {
					if (res.code == 200) {
						this.items = res.data;
					}
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.L-main {
		.header {
			min-height: 440 - 84rpx;
			background: #5498ff url(../../static/workMessage/banner.png) no-repeat;
			background-size: 750rpx 440rpx;
			background-position: left 0 bottom -84rpx;

			.search {
				height: 88rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 0 30rpx;

				.select {
					.selectName {
						display: flex;
						align-items: center;

						text {
							color: #fff;
							margin-right: 15rpx;
						}

						image {
							width: 30rpx;
							height: 30rpx;
						}
					}
				}

				.search_box {
					width: 470rpx;
					height: 56rpx;
					background-color: rgba(255, 255, 255, 0.5);
					border-radius: 28rpx;
					border: solid 2rpx #ffffff;
					display: flex;
					align-items: center;

					.img {
						image {
							width: 30rpx;
							height: 30rpx;
						}

						margin: 0 16rpx 0 32rpx;
					}

					.inp {
						flex: 1;
						overflow: hidden;

						input {
							width: 100%;
							color: #ffffff;
							font-size: 26rpxs;
							padding-right: 30rpx;
						}
					}
				}
			}

			.info {
				display: flex;
				align-items: center;
				padding: 0 30rpx;

				view {
					font-size: 26rpx;
					color: #fff;
					margin-top: 30rpx;

					&:nth-child(1) {
						font-size: 26rpx;
						color: #fff;
						margin-right: 25rpx;
					}

					&:nth-child(2) {
						padding: 0 20rpx;
						height: 41rpx;
						background-color: rgba(255, 255, 255, 0.3);
						border-radius: 21rpx;
						display: flex;
						font-size: 22rpx;
						line-height: 22rpxs;
						align-items: center;
					}
				}
			}

			.theme {
				display: flex;
				flex-direction: column;
				padding-left: 30rpx;
				margin-top: 45rpx;

				text {
					color: #FFFFFF;

					&:nth-child(1) {
						color: 42rpx;
						font-size: #fff;
						line-height: 42rpx;
					}

					&:nth-child(2) {
						color: 32rpx;
						font-size: #fff;
						line-height: 32rpx;
						margin-top: 14rpx;
					}
				}
			}
		}

		.nav {
			display: flex;

			.navBox {
				flex: 1;
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				padding-top: 40rpx;

				image {
					width: 101rpx;
					height: 101rpx;
				}

				text {
					font-size: 28rpx;
					color: #333;
					margin-top: 14rpx;
				}
			}
		}

		.do_thing {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 70rpx;
			margin-bottom: 50rpx;

			view {
				&:nth-child(1) {
					display: flex;
					justify-content: center;
					align-items: center;
					margin-left: 50rpx;

					image {
						width: 40rpx;
						height: 50rpx;
						margin-right: 25rpx;
					}

					text {
						color: #1a1a1a;
						font-size: 32rpx;
						font-weight: bold;
					}
				}

				&:nth-child(2) {
					margin-right: 30rpx;
					width: 114rpx;
					height: 46rpx;
					background-color: #eaf6ff;
					border-radius: 23rpx;
					display: flex;
					justify-content: center;
					align-items: center;

					text {
						display: inline-block;
						font-size: 22rpx;
						color: #179eff;
					}
				}
			}
		}

		.hr {
			height: 12rpx;
			background: #f6f6fc;
		}

		.title {
			height: 100rpx;
			padding: 0 30rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			text {
				&:nth-child(1) {
					color: #333333;
					font-size: 34rpx;
					font-weight: bold;
				}

				&:nth-child(2) {
					color: #999999;
					font-size: 28rpx;
					display: flex;
					align-items: center;
					height: 100%;
				}
			}
		}

		.themeClass {
			margin-bottom: 24rpx;

			.card {
				display: flex;
				padding: 0 30rpx;
				justify-content: space-between;

				view {
					width: 219rpx;
					height: 143rpx;
					background-color: #eaf6ff;
					position: relative;
					padding: 17rpx 0 0 14rpx;
					box-sizing: border-box;

					text {
						font-size: 26rpx;
						color: #333333;
						font-weight: bold;
					}

					image {
						position: absolute;
						right: 12rpx;
						bottom: 8rpx;
					}
				}
			}
		}

		.list_box {
			.accordionBox {
				padding: 0 30rpx;

				.lists {
					view {
						display: flex;
						align-items: center;
						border-bottom: #f1f1f1 1rpx solid;
						height: 114rpx;

						text {
							font-size: 28rpx;
							color: #333333;
							flex: 1;
							overflow: hidden;
							display: -webkit-box;
							-webkit-line-clamp: 2;
							-webkit-box-orient: vertical;

						}

						image {
							height: 24rpx;
							width: 24rpx;
						}
					}
				}

				.list {
					view {
						display: flex;
						justify-content: space-between;
						margin-bottom: 30rpx;

						text {
							color: #333333;
							font-size: 24rpx;
							display: flex;
							align-items: center;

							&::before {
								content: '';
								display: inline-block;
								width: 4rpx;
								height: 26rpx;
								background-color: #188eee;
								margin-right: 20rpx;
							}
						}

						image {
							height: 24rpx;
							width: 24rpx;
							margin-right: 10rpx;
						}
					}
				}
			}
		}
	}
</style>
<style lang="less">
	/deep/.uni-collapse-cell {
		border-color: #f1f1f1;
	}

	/deep/.uni-collapse-cell__title {
		padding: 30rpx 0 !important;
	}

	/deep/.uni-collapse-cell--open {
		background-color: #FFFFFF;
	}
</style>
